#! /bin/bash

LOG_DIR=/var/log
# uid=0 is root
ROOT_UID=0

if [[ "$UID" -ne ROOT_UID ]]; then
    echo "mast be root."
    exit 1
fi

cd LOG_DIR || {
    echo "no such file or directory."
    exit 1
}

cat /dev/null >messages && {
    echo "Logs cleaned up successfully."
    exit 0
}
echo "logs cleaned up fail."
exit 1
